package com.shujia.day09;

import java.util.LinkedList;

public class Demo03LinkedList {
    public static void main(String[] args) {
        /*
            TODO：LinkedList
         */
        LinkedList<Object> linkedList = new LinkedList<>();
        linkedList.add("1");
        linkedList.addFirst("2");
        linkedList.addLast("3");
        System.out.println(linkedList);  // [2, 1, 3]

        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.getLast());

        System.out.println(linkedList.poll());
        System.out.println(linkedList.pollFirst());
        System.out.println(linkedList.pop());
        System.out.println(linkedList);
//        linkedList.removeFirst()
//        linkedList.removeLast()

        /*
            练习：
            1.要求对于Student对象实现入栈和出栈的效果
                先进后出
                同时要求定义一个 容器类  MyStack
            2.再去实现队列效果
         */
    }
}
